﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TwoDimensinalArray
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter array size");
            Console.Write("Enter amount of rows: ");
            int rows = Int32.Parse(Console.ReadLine());
            Console.Write("Enter amount of columns: ");
            int columns = Int32.Parse(Console.ReadLine());

            int[,] resultArray = FillTwoDimensinalArrayByRandomNumbers(rows, columns, 1, 10);
            PrintTwoDimensinalArray(resultArray);
        }

        static int[,] FillTwoDimensinalArrayByRandomNumbers(int rowCount, int columnCount, int randomMinValue, int randomMaxValue)
        {
            int[,] array = new int[rowCount, columnCount];
            Random rnd = new Random();

            for (int i = 0; i < rowCount; i++)
            {
                for (int j = 0; j < columnCount; j++)
                {
                    array[i, j] = rnd.Next(randomMinValue, randomMaxValue + 1);
                }
            }
            return array;
        }

        static void PrintTwoDimensinalArray(int[,] arrayForPrint)
        {
            for (int i = 0; i < arrayForPrint.GetLength(0); i++)
            {
                for (int j = 0; j < arrayForPrint.GetLength(1); j++)
                {
                    Console.Write("{0}\t", arrayForPrint[i, j]);
                }
                Console.WriteLine();
            }
        }
    }
}